package br.com.albatroz.utils;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JpaUtils {

	private static EntityManagerFactory emf;
	private static JpaUtils jpaUtils;
	
	private JpaUtils(){	
		emf = Persistence.createEntityManagerFactory("ProjetoFinalJSF");
	}
	
	public static JpaUtils getInstance(){
		if (jpaUtils == null){ 
			jpaUtils = new JpaUtils();
		}
		
		return jpaUtils;		
	}
	
	public EntityManager getEntityManager(){
		return emf.createEntityManager();
	}
	
}
